<style>
    #template-detail {
        padding: 20px 25px 25px 0;
    }

    #template-detail span {
        margin: 0 0 2px 3px !important;
    }

    .layui-layer-page .layui-layer-content {
        overflow: visible !important;
    }
</style>
<div class="layui-fluid" id="template-detail">
    <form class="layui-form" lay-filter="template-detail-form">
        <div class="layui-form-item">
            <div class="layui-col-md6">
                <label class="layui-form-label website-form-item-require">模板名称：</label>
                <div class="layui-input-block">
                    <input type="text" name="templateName" readonly class="layui-input">
                </div>
            </div>
            <div class="layui-col-md6">
                <label class="layui-form-label website-form-item-require">文件名称：</label>
                <div class="layui-input-block">
                    <a id="fileName"></a>
                </div>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-col-md6">
                <label class="layui-form-label website-form-item-require">菜单名称：</label>
                <div class="layui-input-block">
                    <input type="text" name="menuName" readonly class="layui-input">
                </div>
            </div>
            <div class="layui-col-md6">
                <label class="layui-form-label website-form-item-require">模板类型：</label>
                <div class="layui-input-block">
                    <input type="text" name="templateTypeCode" readonly class="layui-input">
                </div>
            </div>
        </div>

    </form>
</div>

<script data-th-inline="javascript">
    layui.use(['form', 'formSelects','dict'], function () {
        var $ = layui.$,
            formSelects = layui.formSelects,
            form = layui.form,
            dict = layui.dict,
            template = [[${template}]];
        form.render();
        initExpertValue();
        formSelects.render();
        function initExpertValue() {
            if(template.fileName!=null && template.fileName!=''){
                $('#fileName')[0].setAttribute('href', ctx + 'download/' + template.fileId)
                $("#fileName").text(template.fileName)
            }
            let templateTypeCode = dict.getByCode(template.templateTypeCode);
            let templateTypeName = "";

            if (templateTypeCode) {
                templateTypeName = templateTypeCode.name;
            }
            form.val("template-detail-form", {
                "templateName": template.templateName,
                "menuName": template.menuName,
                "templateTypeCode":templateTypeName
            });
        }
    });
</script>